﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using DLV.Library.Utilities;
using DLV.Utilities;

namespace DLV.Data.Entities
{
    public class CustomersController
    {
       public int InsertCustomers(CustomersInfo info)
        {
 
            return SQL.InsertCustomers(info.CusId, info.CusCode,info.CusFullName, info.CusPhone, info.CusEmail, info.CusAddress, info.CusQuantityRequest, info.CusQuantityBooking, info.CusCreatedBy, info.CusCreatedDate, info.CusUpdatedBy, info.CusUpdatedDate, info.CusStatus,info.GusGender, info.CusNotes, info.CusNationalId, info.CusDateofBirth, info.CusCityId, info.CusDistrictId, info.CusWardId,info.CusIdentityCard, info.CusIdentityCardDate, info.CusIdentityCardPlace,info.CusEthnic, info.CusOrigin, info.CusMarriage, info.CusScore);
 
        }
        public void UpdateCustomers(CustomersInfo info)
        {
 
            SQL.UpdateCustomers( info.CusCode,info.CusFullName, info.CusPhone, info.CusEmail, info.CusAddress, info.CusQuantityRequest, info.CusQuantityBooking, info.CusCreatedBy, info.CusCreatedDate, info.CusUpdatedBy, info.CusUpdatedDate, info.CusStatus,info.GusGender, info.CusNotes, info.CusNationalId, info.CusDateofBirth, info.CusCityId, info.CusDistrictId, info.CusWardId,info.CusIdentityCard, info.CusIdentityCardDate, info.CusIdentityCardPlace,info.CusEthnic, info.CusOrigin, info.CusMarriage, info.CusScore, info.CusId);
 
        }
        public void DeleteCustomers(CustomersInfo info)
        {
            DeleteCustomers(info.CusId);
        }
        public void DeleteCustomers(int cusId)
        {
            SQL.DeleteCustomers(cusId);
        }
        public CustomersInfo GetCustomers(int cusId)
        {
            return CBO.FillObject<CustomersInfo>(SQL.GetCustomers(cusId));
        }
        public List<CustomersInfo> ListCustomers()
        {
            return CBO.FillCollection<CustomersInfo>(SQL.ListCustomers());
        }
        public List<CustomersInfo> ListCustomersSearch(CustomersInfo info)
        {
            return CBO.FillCollection<CustomersInfo>(SQL.ListCustomersSearch(info.CusFullName, info.CusCode, info.CusPhone, info.CusEmail, info.CusAddress, info.CusStatus, info.CusGender, info.CusNotes, info.CusNationalId));
        }
        public DataTable SelectCustomers()
        {
            return CBO.ConvertToDataTable(ListCustomers(), typeof(CustomersInfo));
        }
    }
}
